<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="probiz" tagdir="/WEB-INF/tags/probiz"%>
<%@ taglib prefix="order" tagdir="/WEB-INF/tags/order"%>
<%@ taglib prefix="system" tagdir="/WEB-INF/tags/system"%>


<title><fmt:message key="accountMenu.myOrder" /></title>

<content tag="position">
<fmt:message key="accountMenu.businessManager" />&gt;<b> <fmt:message key="accountMenu.myOrder" /></b>
</content>

<div class="tab_05">
	<ul class="content clearfix" id="searchTab">
		<li class="curr"  onclick="goSearchOrders(this,null)">
			<a ><span><fmt:message key="salesOrder.tab.all" /></span></a>
		</li>
		<c:set var="quickFilters" value="${fn:split('9,10',',')}"/>
		<c:forEach items="${quickFilters}" var="quickFilter" varStatus="varStatus">
			<li  onclick='goSearchOrders(this,{"quickFilter":${quickFilter}})' id="quickFilter${quickFilter}"><a><span><fmt:message key="salesOrder.tab.quickFilter.${quickFilter}"/></span></a></li>
		</c:forEach>
	</ul>
</div>
	
<div id="orderList">
	<%@include file="include/orderSearchCriteria.jspf"%>
	<br/>
	<br/>
	<div id="orderResults" name="orderResults" style="position:relative">
		<%--ajaxLoad file="include/csOrderListBody.jsp" --%>
		<%--------保存查询条件 -------%>
		<%@include file="include/orderSearchCriteriaStorage.jspf"%>
	</div>
</div>



<c:set var="ui_datepicker" value="true" scope="request" />

<script>
$j(document).ready(function () {
	<c:choose>
		<c:when test="${not empty param.quickFilter}">
			goSearchOrders($('quickFilter${param.quickFilter}'),{"quickFilter":9});
		</c:when>
		<c:otherwise>
			searchOrders(true,null);
		</c:otherwise>
	</c:choose>
	
});


//li搜索
function goSearchOrders(liDOM,param){
	$j('#searchTab li').removeClass("curr");
	$j(liDOM).addClass("curr");
	if(param != null){
		//如果是过滤搜索则去掉搜索区
		$j('#orderSearchCriteria').hide();
	}else{
		$j('#orderSearchCriteria').show();
	}
	searchOrders(true,param);
}
//验证函数
function validateSearchCriteria(){
	if(!validateForm($j('#orderSearchCriteria').get(0))){
    	return false;
   	}
   	return true;
}

//重设搜索条件
function resetSearchCriteria(){
	fnResetForm("orderSearchCriteria");
}

//刷新订单列表
function refreshOrderList(){
	searchOrders(false);
}
//分页
function fnOnGoToPage(){
	refreshOrderList();
}

//搜索订单 isNew标示是否新的搜索,param标示是否自定义参数搜索
function searchOrders(isNew,param){
	var postData;
	var url;
	if(isNew){
		if(null==param){
			if(validateSearchCriteria()){
				//有搜索结果搜索
			    postData = $j('#orderSearchCriteria :input').serializeArray();
			    url=__ctxPath+"/customer/csOrders/blank.html?doAction=search&btnSearch=1&isSearchResult=1";
				$j("#orderResults").loading().load(url,postData);
		    }else{
		    	return;
		    }
		}else{
			//新的搜索。全部，上架等
			//有搜索结果搜索
			if(param.quickFilter != undefined){
				$j('#orderResults #quickFilter').val(param.quickFilter);
			}
		    postData = $j('#orderResults :input').serializeArray();
		    url=__ctxPath+"/customer/csOrders/blank.html?doAction=search&btnSearch=1";
			$j("#orderResults").loading().load(url,postData);  
		}    
	}else{
		postData = $j('#orderResults :input').serializeArray();
		url=__ctxPath+"/customer/csOrders/blank.html?&doAction=search";
		$j("#orderResults").loading().load(url,postData);  
	} 
	
}
</script>
